<template>
  <i class="icon" :class="iconClass"></i>
</template>

<script>
export default {
  name: 'topDataIcon',
  msg: '',
  props: ['num'],
  data() {
    return {
      iconClass: ''
    }
  },
  watch: {
    num(newV, oldV) {
      if (newV) {
        this.iconClass = this.getClassName()
      } else {
        this.iconClass = ''
      }
    }
  },
  mounted() {},
  methods: {
    getClassName() {
      let num = this.num.slice(0, -1)
      if (num > 0) {
        return 'el-icon-top'
      } else if (num < 0) {
        return 'el-icon-bottom'
      }
    }
  }
}
</script>

<style lang="less">
#topDataIcon {
}
</style>
